let vue=new Vue({
   el:'.page-content',
    data:{
       area:{
           newId:''
       },
    },
    methods:{
       showUpdate:function (uid) {
           axios({
               url:`area/showUpdate`,
               method: 'post',
               data:{
                   aid:uid
               }
           }).then(rs=>{
               this.area=rs.data
           }).catch(error=>{layer.msg(error.message)})
       },
        doUpdate:function () {
            if( this.area.parentId!=layer.changeId) {
                this.area.newId=layer.changeId
            }
            axios({
                url: 'area/doUpdate',
                method:'put',
                data:this.area
            }).then(rs=>{
                let index=parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
                parent.layer.message='更新成功'
            }).catch(error=>{
                layer.msg(error.message)
            })
        },
        hideWindow:function () {
            let index=parent.layer.getFrameIndex(window.name);
            parent.layer.close(index)
        },
        toIcon:function () {
            layer.open({
                type:2,
                title: false,
                area: ['80%', '80%'],
                content: 'area/toIcon',
                end:()=>{
                    this.area.icon=$("#icon-input").val()
                }
            })
        },
        toSelect:function () {
            layer.changeId=this.area.parentId;
            layer.id=this.area.id;
            layer.open({
                type:2,
                title: false,
                area: ['80%', '80%'],
                content: 'area/toSelect',
                end:()=>{

                }
            })
        }
    },
    created:function () {
        this.showUpdate(parent.layer.appId)
    }
});